package com.mcp.weather.model;

import java.util.Map;

/**
 * 天气查询响应模型
 */
public class WeatherResponse {
    private String provider = "amap";
    private QueryInfo query;
    private Object data; // 可以是 RealtimeWeather 或 ForecastWeather
    private Object raw; // 原始高德 API 响应
    private MetaInfo meta;

    public WeatherResponse() {
    }

    public String getProvider() {
        return provider;
    }

    public void setProvider(String provider) {
        this.provider = provider;
    }

    public QueryInfo getQuery() {
        return query;
    }

    public void setQuery(QueryInfo query) {
        this.query = query;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public Object getRaw() {
        return raw;
    }

    public void setRaw(Object raw) {
        this.raw = raw;
    }

    public MetaInfo getMeta() {
        return meta;
    }

    public void setMeta(MetaInfo meta) {
        this.meta = meta;
    }

    /**
     * 查询信息
     */
    public static class QueryInfo {
        private String city;
        private String extensions;

        public QueryInfo() {
        }

        public QueryInfo(String city, String extensions) {
            this.city = city;
            this.extensions = extensions;
        }

        public String getCity() {
            return city;
        }

        public void setCity(String city) {
            this.city = city;
        }

        public String getExtensions() {
            return extensions;
        }

        public void setExtensions(String extensions) {
            this.extensions = extensions;
        }
    }

    /**
     * 元数据信息
     */
    public static class MetaInfo {
        private boolean cached;

        public MetaInfo() {
        }

        public MetaInfo(boolean cached) {
            this.cached = cached;
        }

        public boolean isCached() {
            return cached;
        }

        public void setCached(boolean cached) {
            this.cached = cached;
        }
    }

    /**
     * 错误响应
     */
    public static class ErrorResponse {
        private String error;
        private ErrorDetail errorDetail;

        public ErrorResponse() {
        }

        public String getError() {
            return error;
        }

        public void setError(String error) {
            this.error = error;
        }

        public ErrorDetail getErrorDetail() {
            return errorDetail;
        }

        public void setErrorDetail(ErrorDetail errorDetail) {
            this.errorDetail = errorDetail;
        }
    }

    /**
     * 错误详情
     */
    public static class ErrorDetail {
        private String code;
        private String message;
        private String provider;
        private Map<String, Object> upstream;

        public ErrorDetail() {
        }

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getMessage() {
            return message;
        }

        public void setMessage(String message) {
            this.message = message;
        }

        public String getProvider() {
            return provider;
        }

        public void setProvider(String provider) {
            this.provider = provider;
        }

        public Map<String, Object> getUpstream() {
            return upstream;
        }

        public void setUpstream(Map<String, Object> upstream) {
            this.upstream = upstream;
        }
    }
}

